package chapter23;
import java.util.*;
public class TestStudentMap {
    public static void main(String[] args) {
//        创建一个 HashMap
        Map<Integer, Student> hasMap =new HashMap<>();
        Student a = new  Student(2021, "胖虎");
        Student a1 = new  Student(2022, "dd");
        hasMap.put(a.id, a);
        hasMap.put(a1.id, a1);

        System.out.println(hasMap);

        hasMap.forEach(
                (id, name) -> System.out.println(id+":"+name+"")
        );
        System.out.println(hasMap.get(2021));

    }
}
